const common = require('./webpack.common')
// 坑：merge is not function,需要 花括号提取成员
const { merge } = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
// const CopyWebpackPlugin = require('copy-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = merge(common, {
  mode: 'production',
  devtool: 'nosources-source-map',
  devServer: {
    hot: true,
    contentBase: './public'
    // publicPath: '/index.html'
  },
  plugins: [
    new CleanWebpackPlugin(),
    new CopyPlugin({
      patterns: [
        { from: 'public', to: 'public' }
      ]
    }
    )
  ]
})
